<?php
/**
 * @Author: rocky
 * Date: 2019/10/8
 * Time: 13:55
 */


namespace app\shop\controller\api\v1;


use app\api\service\WechatMiniService;
use app\common\service\WechatMini;
use app\shop\model\ShopOrder;

class Notify
{
    /*
     * 购买商品微信支付回调
     */
    public function pay()
    {
        $data = WechatMini::WePayOrder()->getNotify();
        if ($data['return_code'] == 'SUCCESS') {
            $res = ShopOrder::pay(1, $data['out_trade_no'], $data['cash_fee'] / 100, $data['transaction_id']);
            if ($res) {
                return WechatMini::WePayOrder()->getNotifySuccessReply();
            }
        }
    }
}